﻿#define _CRT_SECURE_NO_WARNINGS 1


#include"mymap.h"
#include"myset.h"

void Print(const yyh::set<int>& tree)
{
	for (auto& e : tree)
	{
		cout << e << ' ';
	}
	cout << endl;
}

void TestSet()
{
	yyh::set<int> tree;
	int arr[] = { 18,10,30,6,15,25,40 };
	for (auto& e : arr)
	{
		tree.insert(e);
	}
	yyh::set<int>::iterator it = tree.begin();
	while (it != tree.end())
	{
		cout << *it << ' ';
		++it;
	}
	cout << endl;
	yyh::set<int>::iterator it1 = tree.end();
	while (it1 != tree.begin())
	{
		--it1;
		cout << *it1 << ' ';
	}
	cout << endl;
	Print(tree);
}

void TestMap()
{
	yyh::map<string, string> tree;
	tree.insert({ "left", "左边" });
	tree.insert({ "right", "右边" });
	tree.insert({ "up", "上边" });
	tree.insert({ "low", "下边" });
	yyh::map<string, string>::iterator it = tree.begin();
	while (it != tree.end())
	{
		cout << it->first << ':' << it->second << endl;
		++it;
	}
	cout << endl;
	tree["insert"];
	tree["left"] = "剩余";
	for (auto& e : tree)
	{
		cout << e.first << ':' << e.second << endl;
	}
	cout << endl;
}

//int main()
//{
//	TestSet();
//	TestMap();
//
//	return 0;
//}